package com.jingyanzi.resallocation.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.jingyanzi.resallocation.domain.AreaDO;
import com.jingyanzi.resallocation.domain.AssistantDO;
import com.jingyanzi.resallocation.domain.ClubDO;
import com.jingyanzi.resallocation.domain.SalesGroupDO;
import com.jingyanzi.resallocation.domain.SampleDO;
import com.jingyanzi.resallocation.domain.StoreDO;
import com.jingyanzi.resallocation.entity.ResArea;
import com.jingyanzi.resallocation.entity.ResAssistant;
import com.jingyanzi.resallocation.entity.ResClub;
import com.jingyanzi.resallocation.entity.ResSalesgroup;
import com.jingyanzi.resallocation.entity.ResSample;
import com.jingyanzi.resallocation.entity.ResStore;
import com.jingyanzi.resallocation.util.BeanUtilsExtends;

/**
 * @author reagan
 * @Description:基础服务类主要用来实现底层的通用方法
 */
public class BaseServiceImpl {
	
	public boolean isNumberNotEmpty(Integer value) {
		if(value == null) return false;
		else if(value == 0) return false;
		return true;
	}


	/**
	 * 对象拷贝单个实体到对象中
	 * 
	 * @param maAccountDiscount
	 * @return 返回DO对象
	 */
	public AssistantDO getAssistantDO(ResAssistant assistant) {
		if (assistant == null)
			return null;
		AssistantDO dst = new AssistantDO();
		return BeanUtilsExtends.copyProperties(dst, assistant) ? dst : null;
	}

	/**
	 * 对象拷贝多个实体到列表中
	 * 
	 * @param List
	 * @return List
	 */
	public List<AssistantDO> getAssistantDOList(List<ResAssistant> list) {
		List<AssistantDO> result = new ArrayList<AssistantDO>();
		if (list != null && !list.isEmpty()) {
			for (ResAssistant org : list) {
				AssistantDO org1 = getAssistantDO(org);
				if (org1 != null) {
					result.add(org1);
				}
			}
		}
		return result;
	}

	/**
	 * 对象拷贝单个实体到对象中
	 * 
	 * @param obj
	 * @return 返回DO对象
	 */
	public ClubDO getClubDO(ResClub obj) {
		if (obj == null)
			return null;
		ClubDO dst = new ClubDO();
		return BeanUtilsExtends.copyProperties(dst, obj) ? dst : null;
	}

	/**
	 * 对象拷贝多个实体到列表中
	 * 
	 * @param List
	 * @return List
	 */
	public List<ClubDO> getClubDOList(List<ResClub> list) {
		List<ClubDO> result = new ArrayList<ClubDO>();
		if (list != null && !list.isEmpty()) {
			for (ResClub org : list) {
				ClubDO org1 = getClubDO(org);
				if (org1 != null) {
					result.add(org1);
				}
			}
		}
		return result;
	}

	/**
	 * 对象拷贝单个实体到对象中
	 * 
	 * @param obj
	 * @return 返回DO对象
	 */
	public SalesGroupDO getSalesGroupDO(ResSalesgroup obj) {
		if (obj == null)
			return null;
		SalesGroupDO dst = new SalesGroupDO();
		return BeanUtilsExtends.copyProperties(dst, obj) ? dst : null;
	}

	/**
	 * 对象拷贝多个实体到列表中
	 * 
	 * @param List
	 * @return List
	 */
	public List<SalesGroupDO> getSalesGroupDOList(List<ResSalesgroup> list) {
		List<SalesGroupDO> result = new ArrayList<SalesGroupDO>();
		if (list != null && !list.isEmpty()) {
			for (ResSalesgroup org : list) {
				SalesGroupDO org1 = getSalesGroupDO(org);
				if (org1 != null) {
					result.add(org1);
				}
			}
		}
		return result;
	}

	public SampleDO getSampleDO(ResSample obj) {
		if (obj == null)
			return null;
		SampleDO dst = new SampleDO();
		return BeanUtilsExtends.copyProperties(dst, obj) ? dst : null;
	}

	/**
	 * 对象拷贝多个实体到列表中
	 * 
	 * @param List
	 * @return List
	 */
	public List<SampleDO> getSampleDOList(List<ResSample> list) {
		List<SampleDO> result = new ArrayList<SampleDO>();
		if (list != null && !list.isEmpty()) {
			for (ResSample org : list) {
				SampleDO org1 = getSampleDO(org);
				if (org1 != null) {
					result.add(org1);
				}
			}
		}
		return result;
	}

	public StoreDO getStoreDO(ResStore obj) {
		if (obj == null)
			return null;
		StoreDO dst = new StoreDO();
		return BeanUtilsExtends.copyProperties(dst, obj) ? dst : null;
	}

	public List<StoreDO> getStoreDOList(List<ResStore> list) {
		List<StoreDO> result = new ArrayList<StoreDO>();
		if (list != null && !list.isEmpty()) {
			for (ResStore org : list) {
				StoreDO org1 = getStoreDO(org);
				if (org1 != null) {
					result.add(org1);
				}
			}
		}
		return result;
	}
	
	public AreaDO getAreaDO(ResArea obj) {
		if (obj == null)
			return null;
		AreaDO dst = new AreaDO();
		return BeanUtilsExtends.copyProperties(dst, obj) ? dst : null;
	}

	public List<AreaDO> getAreaDOList(List<ResArea> list) {
		List<AreaDO> result = new ArrayList<AreaDO>();
		if (list != null && !list.isEmpty()) {
			for (ResArea org : list) {
				AreaDO org1 = getAreaDO(org);
				if (org1 != null) {
					result.add(org1);
				}
			}
		}
		return result;
	}
}
